package com.ruoyi.contract.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/freemarker.ftl")
public class FreemarkerController extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO 搞一个数据，存储在request作用域中：(数据模型)
        req.setAttribute("msg", "hello,Freemarker!");
        // TODO 请求转发
        req.getRequestDispatcher("freemarker.ftl").forward(req, resp);
    }
}
